<template>
    <div>
        <table-index
            :dataSource="dataSource"
            :tableColumns="tableColumns"
            :btnList="[]"
            :height="400"
            :pageSize="pageSize"
            :pageCount="pageCount"
            :pageNo="pageNo"
            @pageChange="pageChange"
        ></table-index>
    </div>
</template>

<script>
import tableIndex from '@/components/customComponents/customeTable/iviewTable/singleViewTable'
import {AjaxCommon} from '@/libs/apiCommon'
import {PopupCommon} from '@/libs/popupCommon'
export default {
    components: {
        tableIndex
    },
    props: ['id'],
    data() {
        return {
            pageSize: 20,
            pageCount: 0,
            pageNo: 1,
            dataSource: [],
            tableColumns: [
                {
                    type: 'index',
                    width: 60,
                    align: 'center'
                },
                {
                    key: 'user_id',
                    title: '账户ID'
                },
                {
                    key: 'ac_sum',
                    title: '账户余额'
                },
                {
                    key: 'pay_sum',
                    title: '支付金额'
                },
                {
                    key: 'pay_time',
                    title: '支付时间'
                }
            ]
        }
    },
    created() {},
    methods: {
        pageChange(p) {
            this.pageNo = p
            this.initPage()
        },
        // 初始化事件
        initPage() {
            let self = this
            let params = `/api/QuotaAllot/GetAcPayInfo?ac_guid=${this.id}&PageSize=${this.pageSize}&PageIndex=${this.pageNo}`
            AjaxCommon(params, 'get', null).then((res) => {
                console.log(res, 'res...........')
                if (res?.data?.Code == 200) {
                    const data = res?.data.Message
                    self.dataSource = data?.rows
                    self.pageCount = parseInt(data?.total)
                } else {
                    PopupCommon.notify('error', res?.data?.msg)
                }
            })
        }
    },
    mounted() {
        this.initPage()
    }
}
</script>

<style></style>
